package com.thinvent.recommend.manager.dto;

import com.thinvent.recommend.entity.KbFileInfo;
import lombok.Data;

import java.io.Serializable;

@Data
public class KbFileContentDTO implements Serializable {
    private static final long serialVersionUID = -3668890308902711322L;

    /**
     * 文档业务 ID
     */
    private String id;

    /**
     * 空间 ID
     */
    private String spaceId;

    /**
     * 存储路径
     */
    private String saveFullPath;

    /**
     * 解析出的纯文本内容
     */
    private String content;

    public KbFileContentDTO() {}

    public KbFileContentDTO(String id, String spaceId, String saveFullPath, String content) {
        this.id = id;
        this.spaceId = spaceId;
        this.saveFullPath = saveFullPath;
        this.content = content;
    }

    /** 从 KbFileInfo + content 构造 DTO */
    public static KbFileContentDTO from(KbFileInfo info, String content) {
        return new KbFileContentDTO(
                info.getId(),
                info.getSpaceId(),
                info.getSaveFullPath(),
                content
        );
    }
}
